// depends on dom.js

(function() {

Element.addMethods({
		fire: function fire(type) {
		// TODO: support event options, key events, data available events
		event = document.createEvent("MouseEvents");
		event.initMouseEvent(type, true, true, this.ownerDocument.defaultView,
			0, 0, 0, 0, 0, false, false, false, false, 0, null);
		this.dispatchEvent(event);
		return this;
	}

});

// Firing events (IE)
if (!document.createEvent && document.fireEvent) {
	Element.Methods.fire = function fire(type, event) {
		this.fireEvent("on"+type, event || {});
		return this;
	};
}

Event.fire = function fire(element, type) {
	return Element.exend(element).fire(type);
};

})();